﻿#pragma execution_character_set("utf-8")
#include "ConcreteCompany.h"
#include "HRDepartment.h"
#include "FinanceDepartment.h"
#include <memory>
#include <QDebug>

using namespace std;

int main(int argc, char *argv[])
{
    ConcreteCompany root("北京总公司");
    root.Add(shared_ptr<HRDepartment>(new HRDepartment("总公司人力资源部")));
    root.Add(shared_ptr<FinanceDepartment>(new FinanceDepartment("总公司财务部")));

    auto comp = shared_ptr<ConcreteCompany>(new ConcreteCompany("上海华东分公司"));
    comp->Add(shared_ptr<HRDepartment>(new HRDepartment("上海华东分公司人力资源部")));
    comp->Add(shared_ptr<FinanceDepartment>(new FinanceDepartment("上海华东分公司财务部")));
    root.Add(comp);

    auto comp1 = shared_ptr<ConcreteCompany>(new ConcreteCompany("南京办事处"));
    comp1->Add(shared_ptr<HRDepartment>(new HRDepartment("南京办事处人力资源部")));
    comp1->Add(shared_ptr<FinanceDepartment>(new FinanceDepartment("南京办事处财务部")));
    comp->Add(comp1);

    auto comp2 = shared_ptr<ConcreteCompany>(new ConcreteCompany("杭州办事处"));
    comp2->Add(shared_ptr<HRDepartment>(new HRDepartment("杭州办事处人力资源部")));
    comp2->Add(shared_ptr<FinanceDepartment>(new FinanceDepartment("杭州办事处财务部")));
    comp->Add(comp2);

    qDebug() << "\n结构图：";
    root.Display(1);

    qDebug() << "\n职责：";
    root.LineOfDuty();

    return 0;
}
